package com.gjintel.framework.res.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.gjintel.business.proj.model.ProjectBidInfo;
import com.gjintel.framework.res.dao.IResDao;
import com.gjintel.framework.res.model.Resources;
import com.gjintel.sdk.base.dao.HibernateGenericDAO;
/**
 * @description 资源数据访问实现
 * @author fengya
 * @date 2016-3-14 下午06:12:23
 */
@Repository("resDao")
public class ResDaoImpl extends HibernateGenericDAO implements IResDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<Resources> findResources(String businessId) {
		return this.find("from Resources r where r.businessId=?", businessId);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Resources> findAll() {
		return this.find("from Resources r");
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Resources> findByBusinessIdAndFlag(String businessId, Integer flag) {
		String hql = "from Resources r where r.businessId = ? and functionFlog = ?";
		List<Object> paramList = new ArrayList<Object>();
		paramList.add(businessId);
		paramList.add(flag);
		return (List<Resources>)this.find(hql, paramList.toArray());
	}

}
